package com.xqx.controller;

import com.xqx.service.UserService;
import com.xqx.service.impl.UserServiceImpl;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author：xingquanxiang createTime：2019/10/2 1:43
 * description:
 */
public class UserController {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userService = (UserService)app.getBean("userService");
        //此时自己创建创建对象会出现空指针异常 因为并没有从容器中拿取，也就dao实例没有拿到
        // UserService userService = new UserServiceImpl();
        userService.save();
    }
}
